<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head>
{% load staticfiles %}
<link rel="stylesheet" href="{% static "css/base.css" %}" type="text/css" media="screen" />
<style type="text/css">

table{
box-shadow: 0px 50px 200px 50px black;
border-collapse:collapse;
}

td{ padding:10px;}

</style>

<script type="text/javascript">
function validateForm(){
	var a = document.forms["commentform"]["uname"].value;
	var b = document.forms["commentform"]["comments"].value;
	if (a==null || a == ""){
		alert("Enter your username.");
		return false;
		}
	else if (b == null || b == ""){
		alert("You did not write the comment.");	
		return false;
	}
}

function logout(){
		window.location = "/logout/";
	}
	
function display(){
	var a = {{message}}
	document.write(a);
}

function home(){
		window.location="/blogit/viewblog/";
}

function message(){
alert({{message}})

}
</script>
</head>

<body>
<div align="center">
<table summary="" width="900" align="center" border="1" frame="">
	<tr>
		<td colspan="3">
		Welcome, {{username}}<img src="{% static "images/settings.gif"%}"><button name="" onclick="home()">Home</button>
		<div style="float:right;"><button type="button" onclick="logout()">Logout</button></div>	
		</td>
	</tr>
<tr>
	<td align="center" height="200" name="{{blogname}}" style="font-size:45px;">{{blogname}}<br>
		<div align="bottom" style="font-size:14px;"><i>Published on {{pubdate}}</i></div></td>
</tr>
<tr>
	<td class="padding" height="500" align="center">{{content}}</td>
</tr>
<tr><td>{%for x in con %}
	{{x.2}} - written by {{x.0}} on {{x.1}}<hr><br>
{%endfor%}
<br>
		No of comments: {{comments_count}}<br>
		</td>
	</tr>
<tr>
	<td height="400" align="left" >
		<div align="center" >
		<form name="commentform" action="/theblog/addcomment/submit/?blogname={{blogname}}" onsubmit="return validateForm()" method="POST">{% csrf_token %}
		Username: <input type="text" name="uname"><br>
						<textarea rows="10" cols="40" name="comments"></textarea><br>
						<input type="submit" value="Submit">
		</form>
		</div>
	</td>	
</tr>
</table>
</div>
</body>
</html>
